 #@layout() #define css() #@layout_css?()
<link rel="stylesheet"
	href="#(CPATH)/static/components/datepicker/css/bootstrap-datepicker3.min.css">
#end #define script() #@layout_script?()
<script
	src="#(CPATH)/static/components/datepicker/js/bootstrap-datepicker.min.js"></script>
<script
	src="#(CPATH)/static/components/datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
<script>
	$("input[hint='date']").datepicker({
		format : 'yyyy-MM-dd HH:mm:ss',
		language : 'zh-CN'
	});

	function doSubmit() {
		ajaxSubmit("#form", function(data) {
			$("#entryId").attr("value", data.id);
			toastr.success('内容保存成功。');
		})
	}

	$("#submit").on("click", function() {
		doSubmit();
	})
	$(".choseImage").on("click", function () {
        layer.data.src = null;
        layer.open({
            type: 2,
            title: '选择图片',
            anim: 2,
            shadeClose: true,
            shade: 0.5,
            area: ['90%', '90%'],
            content: jpress.cpath + '/admin/attachment/browse',
            end: function () {
                if (layer.data.src != null) {
                    var src = layer.data.src;
                    $("#journalContent").append("![]("+src+")");
                }
            }
        });
    });
</script>

#end #define content()
<div class="content-wrapper">

	<section class="content-header">
		<h1>
			编辑/新增 说说 <small>Edit</small>
		</h1>
	</section>

	<section class="content">

		<div class="row">
			<div class="col-xs-12">
				<div class="box box-primary">
					<div class="box-header ">
						<h3 class="box-title"></h3>
					</div>
					<form class="form-horizontal form-setting" autocomplete="off"
						action="/admin/Journal/jpress_addon_journal/doSave" method="POST"
						id="form">
						<div class="box-body ">
							<input type="hidden" id="entryId" name="jpressAddonJournal.id"
								value="#(jpressAddonJournal.id ??)">
							<div class="form-group">
								<label class="col-sm-2 control-label">说说</label>
								<div class="col-sm-6">
									<textarea id=journalContent name="jpressAddonJournal.content"  rows="5"
										class="form-control">#(jpressAddonJournal.content ??)</textarea>
									<button type="button" 
										class="btn btn-default btn-sm choseImage">选择图片</button>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">创建时间 <span
									style="color: red;">*</span></label>
								<div class="col-sm-6">

									<input type="input" class="form-control datetimepicker"
										placeholder="点击选择" name="jpressAddonJournal.created"
										value="#date(jpressAddonJournal.created ?? now,'yyyy-MM-dd HH:mm:ss')">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-2 control-label">状态 <span
									style="color: red;">*</span></label>
								<div class="col-sm-6">
									<select name="jpressAddonJournal.status" class="form-control">
										<option #(jpressAddonJournal.status ?? == 1 ? selected :
											class="" ) value="1">通过</option>
										<option #(jpressAddonJournal.status ?? == 2 ? selected :
											class="" ) value="2">失效</option>
										<option #(jpressAddonJournal.status ?? == 3 ? selected :
											class="" ) value="3">待审核</option>
									</select>
								</div>
							</div>
						</div>
						<!-- /.box-body -->
						<div class="box-footer">
							<div class="col-sm-offset-2 col-sm-10 submit-block">
								<div class="box-submit">
									<button id="submit" type="button" class="btn btn-primary">提交</button> &nbsp;&nbsp;&nbsp;&nbsp;
									<a href="/admin/Journal/jpress_addon_journal">返回</a>
								</div>
							</div>
						</div>
						<!-- /.box-footer -->
					</form>
				</div>
			</div>
		</div>

	</section>

</div>
#end
